IF exists(SELECT * FROM dbo.sysobjects WHERE name='geefVakrapport' AND xtype='P') 
BEGIN
	DROP PROCEDURE geefVakrapport
END
GO

CREATE PROCEDURE geefVakrapport(
@iNr char(7),@periode varchar(2),
@jaar varchar(4))
as
set nocount on
select XMLtekst,XSLtekst 
from  vakrapportXML as xml 
	left join vakrapportXSL as xsl
	on xml.klas = xsl.klas 
             and xml.jaar = xsl.jaar
		and xml.periode = xsl.periode
	
where xml.inschrijvingsNr = @iNr and xml.jaar=@jaar and xml.periode=@periode